package axht.trade.android.listview;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class BaseListViewAdapter extends AppCompatActivity {

    private ListView lv_base;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.base_list_view_adapter);
        lv_base = findViewById(R.id.lv_base);

        //准备集合数据
        List data = new ArrayList<Menu>();
        data.add(new Menu(R.drawable.f1, "name----1", "content----1"));
        data.add(new Menu(R.drawable.f2, "name----2", "content----2"));
        data.add(new Menu(R.drawable.f3, "name----3", "content----3"));
        data.add(new Menu(R.drawable.f4, "name----4", "content----4"));
        data.add(new Menu(R.drawable.f5, "name----5", "content----5"));
        data.add(new Menu(R.drawable.f6, "name----6", "content----6"));
        data.add(new Menu(R.drawable.f7, "name----7", "content----7"));
        data.add(new Menu(R.drawable.f8, "name----8", "content----8"));
        data.add(new Menu(R.drawable.f9, "name----9", "content----9"));
        data.add(new Menu(R.drawable.f10, "name----10", "content----10"));
        //准备BaseAdapter对象
        MyAdapter adapter = new MyAdapter(data,this);
        //设置Adapter显示列表
        lv_base.setAdapter(adapter);
    }
}
